package com.jiyun.controller;

import com.jiyun.feign.FeignUser;
import com.jiyun.feign.RaceFeign;
import com.jiyun.model.Paper;
import com.jiyun.model.RaceDto;
import com.jiyun.vo.PaperShow;
import com.jiyun.vo.ResultResopnse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/* *
 * @Author nxj
 * @Date 2023 08 2023/8/28 11 18
 * */
@RestController
@RequestMapping("race")
public class RaceController {


    @Autowired
    private RaceFeign raceFeign;
    @Autowired
    private FeignUser feignUser;

    @PostMapping("findRace")
    public ResultResopnse findRace(@RequestBody RaceDto raceDto){
        return raceFeign.findRace(raceDto);
    }

    @GetMapping("findRaceStatus")
    public ResultResopnse findRaceStatus(){
        return raceFeign.findRaceStatus();
    }
    @GetMapping("findRaceId")
    public ResultResopnse findRace(Integer id){
        return raceFeign.findRaceId(id);
    }

    @GetMapping("findTeamAll")
    public ResultResopnse findTeamAll(){
        return feignUser.findTeamAll();
    }
    @GetMapping("toAdd")
    public ResultResopnse toAdd(Integer teamId,Integer raceId){
        return raceFeign.toAdd(teamId,raceId);
    }
    @GetMapping("toRaceStart")
    public ResultResopnse toRaceStart(Integer raceId){
        return raceFeign.toRaceStart(raceId);
    }
    @GetMapping("findTeamName")
    public ResultResopnse findTeamName(@RequestParam("raceId")Integer raceId){
        return feignUser.findTeamName(raceId);
    }

    @GetMapping("showQuiz")
    public ResultResopnse showQuiz(@RequestParam("raceId")Integer raceId){
        return raceFeign.showQuiz(raceId);
    }
    @PostMapping("showPaper")
    public ResultResopnse showPaper(@RequestBody PaperShow paperShow){
        return raceFeign.showPaper(paperShow);
    }
    @PostMapping("addAll")
    public ResultResopnse addAll(@RequestBody Paper paper){
        return raceFeign.addAll(paper);
    }

    @GetMapping("delPaperDan")
    public ResultResopnse delPaperDan(){
        return raceFeign.delPaperDan();
    }
}
